<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>双色球</title>
    <style>
        li {
            width: 40px;
            height: 40px;
            background: red;
            color: #fff;
            margin: 5px;
            float: left;
            list-style: none;
            border-radius: 50%;
            text-align: center;
            line-height: 40px;
            font-size: 18px;
            font-weight: bold;
        }
    </style>
    <script>
		function toDouble(n){return n<10?'0'+n:''+n};
		function ran(n,m){ return parseInt(Math.random()*(m-n)+n)}
		function findInArr(n,arr)
		{	for(var i=0;i<arr.length;i++)
			{
				if(n==arr[i])
				{
					return true;
				}
			}
			return false;	
		};
		function toSort()
		{
			sort(function(a,b)
			{
				if(a<b){return b-a}
			})
		}
		//alert(findInArr(5,[123456789]))
		
		//document.write(arr);
		window.onload=function()
		{	var oInput=document.getElementById('input');
			var timer=null;
			function scroll()
			{
				var aLi=document.getElementsByTagName('li');
				aLi[aLi.length-1].style.background='blue';
					var arr=[];
					while(arr.length<6)
					{	var n=toDouble(ran(1,34));
						if(!findInArr(n,arr))
						{
							arr.push(n);
							var arr2=arr.sort(function(a,b){if(a>b){return a-b}});
						}
					}
				for(var i=0;i<aLi.length;i++)
				{
					aLi[i].innerHTML=arr2[i];
				}
				aLi[aLi.length-1].innerHTML=toDouble(ran(1,17));
			}
			scroll();
			oInput.onclick=function()
			{	clearInterval(timer);
				timer=setInterval(scroll,10);
				setTimeout(function(){clearInterval(timer)},600)
			}
			

			
		}
	</script>
</head>

<body>
    <input type="button" value="随机一注" id="input">
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>

</html>